﻿@{
    Layout = null;
    Model.Intelligence_AutoWindow autoWindowData = ViewBag.AutoWindow;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>管理工具</title>
    <!--SEO优化部分 & 全局样式部分-->
    @Html.Partial("_Title")
    <script src="~/Theme/layui/layui.js"></script>
    <script src="~/Theme/layer/layer.js"></script>
    <link href="~/Theme/css/IntelligenceManageCSS.css" rel="stylesheet" />
</head>
<body class="layui-layout-body">
    <div class="layui-layout layui-layout-admin">
        <!--头部-->
        @Html.Partial("_Top")
        <!--左侧-->
        <div class="layui-side layui-bg-black">
            <div class="layui-side-scroll">
                <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
                <ul class="layui-nav layui-nav-tree" lay-filter="test">
                    <li class="layui-nav-item"><a href="/IntelligenceManage/AutoResend">自动重发商品</a></li>
                    <li class="layui-nav-item"><a href="/IntelligenceManage/AutoAppraise">自动评价订单</a></li>
                    <li class="layui-nav-item layui-this"><a href="/IntelligenceManage/AutoWindow">自动橱窗位</a></li>
                    <li class="layui-nav-item"><a href="/IntelligenceManage/AutoStock">自动补库存</a></li> 
                </ul>
            </div>
        </div>

        <div class="layui-body" style="">
            <fieldset class="layui-elem-field layui-field-title mt20">
                <legend>自动橱窗设置</legend>
            </fieldset>
            <div class="layui-row">
                <div class="layui-form" action="">

                    <div class="layui-form-item">
                        <label class="layui-form-label">橱窗开关</label>
                        @*<div class="layui-input-block">
                            <input type="checkbox" checked="" name="open" lay-skin="switch" lay-filter="switchTest" lay-text="开启|关闭">
                        </div>*@
                        <div class="layui-input-block">
                            @if (autoWindowData.IsAutoWindow)
                            {
                                <input type="checkbox" name="open" checked="" lay-skin="switch" lay-text="开启|关闭">
                            }
                            else
                            {
                                <input type="checkbox" name="open" lay-skin="switch" lay-text="开启|关闭">
                            }
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">橱窗信息</label>
                        <div class="layui-input-block">
                            <span>你共有：<span class="layui-badge">19</span>个橱窗位</span>，
                            <span>已使用：<span class="layui-badge">683</span>个</span>
                            <span>还剩余：<span class="layui-badge">683</span>个</span>
                            <a class="font-blue ml20" href="https://work.1688.com/?spm=0.0.0.0.oPaemO#app/offer/showWindowRecommend///wholesale.1688.com/showwindow/show_window_recommend.htm?tracelog=work_appDepartment_windows_mainMenu/-3812129808015748108" target="_blank">查看详情</a>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">推荐商品范围</label>
                        <div class="layui-input-block">
                            
                            @if (autoWindowData.IsAllProduct)
                            {
                                <input type="radio" name="IsAllProduct" value="true" title="全店" checked="checked">
                                <input type="radio" name="IsAllProduct" value="false" title="按类目">
                            }
                            else
                            {
                                <input type="radio" name="IsAllProduct" value="true" title="全店">
                                <input type="radio" name="IsAllProduct" value="false" title="按类目" checked="checked">
                            }
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">必推商品</label>
                        <div class="layui-input-block">
                            <span><span >7</span>个</span>
                            <a href="#" class="font-blue">设置</a>                           
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">禁推商品</label>
                        <div class="layui-input-block">
                            <span><span>3</span>个</span>
                            <a href="#" class="font-blue">设置</a>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">橱窗商品常识</label>
                        <div class="layui-input-block mt20 border-p1-c1">
                            <ul class="ih30 f12">
                                <li><span class="layui-badge-dot"></span>1.橱窗展位是阿里巴巴提供给优质卖家的激励服务，目前所有诚信通用户都可以使用橱窗产品功能；。</li>
                                <li><span class="layui-badge-dot"></span>2.产品信息质量达到4星或以上，并且支持网上订购的销售中的产品才能推荐到橱窗；卖家可到阿里后台商品体检中心查看商品质量；。</li>
                                <li><span class="layui-badge-dot"></span>3.请确保其他软件的自动橱窗是关闭状态，否则您的产品会不停被取消推荐和推荐。</li>
                                <li><span class="layui-badge-dot"></span>3.阿里的取消推荐规则： 已推荐商品数大于橱窗位数，系统将先取消无交易量商品中浏览次数较少的商品，再从有交易的商品中取消交易量较少的商品。</li>
                            </ul>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn submitbtn" lay-submit="" lay-filter="demo1">保存设置</button>
                        </div>
                    </div>
                </div>
            </div>

            <input type="hidden" value="@autoWindowData.MemberId" id="MemberId" />
            <!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
            <script>


                layui.use(['form', 'layedit', 'laydate'], function () {

                    // 点击保存。
                    $(".submitbtn").click(function () {

                        var MemberId = $("#MemberId").val();
                        var open = $("input[name='open']").prop('checked')
                        var IsAllProduct = $("input[name='IsAllProduct']:checked").val();
                        
                        var data = JSON.stringify({ MemberId: MemberId, open: open, IsAllProduct: IsAllProduct, customResend: "必推产品" });

                        //提示弹层
                        layer.msg('正在提交保存...', { icon: 16, shade: [0.5, '＃f5f5f5'], scrollbar: false, offset: '300px', time: 50000 });
                        $.ajax({
                            url: "/api/IntelligenceManageAPI/UpdateAutoWindow",
                            type: "Post",
                            dataType: "json",
                            data: { data: data },
                            success: function (data) {

                                //关闭弹层提示
                                layer.closeAll();

                                if (data == true) {
                                    layer.msg('保存成功', {
                                        offset: '60px'
                                    });
                                }
                                else {

                                    layer.msg('保存失败', {
                                        offset: '60px'
                                    });

                                }
                            }
                        })

                    })
                });
            </script>
        </div>
        <!--底部-->
        @*@Html.Partial("_Foot")*@
    </div>
</body>
</html>



